import { request } from '../utils/request';

export interface BaseApplicationData {
    id?: number;
    appId: string;
    appName: string;
    appOwner?: string;
    devTeam?: string;
    businessDomain?: string;
    techStack?: string;
    appType?: string;
    status?: string;
    description?: string;
    createTime?: string;
    updateTime?: string;
}

export interface BaseApplicationPageRequest {
    pageNum?: number;
    pageSize?: number;
    appName?: string;
    devTeam?: string;
    businessDomain?: string;
}

export interface BaseApplicationPageResponse {
    records: BaseApplicationData[];
    total: number;
    size: number;
    current: number;
    pages: number;
}

/**
 * 分页查询基础应用列表
 */
export const getBaseApplicationsPage = (params: BaseApplicationPageRequest) => {
    return request({
        url: '/base-application/page',
        method: 'GET',
        params,
    });
};

/**
 * 获取所有基础应用列表
 */
export const getAllBaseApplications = () => {
    return request({
        url: '/base-application/all',
        method: 'GET',
    });
};

/**
 * 根据应用ID查询基础应用信息
 */
export const getBaseApplicationByAppId = (appId: string) => {
    return request({
        url: `/base-application/${appId}`,
        method: 'GET',
    });
};

/**
 * 搜索基础应用
 */
export const searchBaseApplications = (keyword: string) => {
    return request({
        url: '/base-application/search',
        method: 'GET',
        params: { keyword },
    });
};